<html>
<head><#include "common/common.html"/>
<meta charset="UTF-8"><#include "common/css_js.html"/> <#include
"common/fupage.html" /><#include "common/artdialog.html"/>
<script type="text/javascript">
	var backUrl = base + "/role";
	function del(id, name) {
		var d = dialog({
			title : defaultAlertTitle,
			content : '确定要删除角色?',
			cancel : function(){
				load(backUrl);
			},
			ok : function() {
				post(base + "/role/delete.js?v=${bv}on", {
					"id":id
				}, function(data) {
					if (data.code == 1) {
						load(backUrl);
					}
				});
			}
		});
		d.show();
	}
</script>
</head>
<body>
	<div >
	   <div><a href="${base}/role/add.html" class="btn btn-success">新增</a></div>
		<table class="table table-bordered table-hover table-condensed" >
			<thead>
				<tr>
					<th>角色名</th>
					<th>备注</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody id="bodyHolder"></tbody>
		</table>
		<div id="pageHolder"></div>
	</div>
	<script>
		(function() {
			var fuPage = new FuPage(
					{
						"url" : "${base}/role/list.js?v=${bv}on",
						"params" : {
							"pageNo" : 1,
							"pageSize" : 10
						},
						
						"bodyHolder" : "bodyHolder",
						"pageHolder" : "pageHolder",
						"template" : "<tr><td>{name}</td><td>{remark}</td>"
								+ "<td><a href='${base}/role/edit.html?id={id}'>编辑</a>|<a href='javascript:;' onclick='del(\"{id}\",\"{name}\");'>删除</a>"
								+ "</tr>"
					});
			fuPage.send();
		})();
	</script>
</body>
</html>
<!-- <div id="tb" style="padding: 5px; height: auto; display: none;">
	<buttonbar style="margin-bottom:5px"> <a
		data-options="type:'add',tplurl:'/role/add.html'"
		   iconCls="icon-add">新增</a>
	<a data-options="type:'edit',tplurl:'/role/edit.html',url:'/role/edit.html',data:['id']"
		   iconCls="icon-edit">编辑</a> 
		<a data-options="url:'/role/delete.js?v=${bv}on',data:['id']"
		   iconCls="icon-remove">删除</a>
		</buttonbar>
</div>


<script type="text/javascript">
	require([ "grid/grid", "layout/tabs" ], function(grid, tabs) {

		var tb = new tabs();

		var formatMoney = function(value, row, index) {
			return value * 1.00 / 100;
		};
		var formatStatus = function(value, row, index) {
			var strStatus = "";
			if (value == 1) {
				strStatus = "失败";
			} else if (value == 2) {
				strStatus = "无效";
			} else if (value == 11) {
				strStatus = "等待处理";
			} else if (value == 21) {
				strStatus = "提现处理中";
			} else if (value == 31) {
				strStatus = "提现成功";
			}
			return strStatus;
		};
		var gridSetting = {
			url : '/role/list.js?v=${bv}on',
			toolbar : "#tb",
			columns : [ [ {
				field : '',
				checkbox : true
			}, {
				field : 'id',
				title : '角色id'
			}, {
				field : 'name',
				title : '角色名'
			}, {
				field : 'remark',
				title : '备注'
			} ] ]
		};
		new grid(gridSetting);

	});
</script> -->
